package com.yun.algorithmproblem.leetcode;

public class Leetcode1287 {

    public int findSpecialInteger(int[] arr) {
        int n = arr.length;
        int target = n / 4 + 1;
        int prev = Integer.MAX_VALUE;
        int cnt = 0;
        for (int i : arr) {
            if (i != prev) {
                prev = i;
                cnt = 0;
            }
            cnt++;
            if (cnt >= target) {
                return i;
            }
        }
        return 0;
    }
}
